STEP 7: Let's also reformat the time so that we know whether it is AM or PM.

  • Locate this line of code from the last activity: my_time·=·my_datetime.strftime("%I:%M")¬
  • Inside the parentheses, add to the string so that it looks like this: "%I:%M %p".
  • Take careful note that there is a space after the M. This small addition will let us know if it is AM or PM.
  • Click Run then click on the Console button to see the newly formatted time!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)